public class T {
    public static void main(String[] args) {

        Object lock = new Object();
        new  Thread(()->{
            synchronized (lock) {
                try {
                    System.out.println("t1 read wait");
                    lock.wait();
                    System.out.println("t1 was notify by...");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();

        new  Thread(()->{
            synchronized (lock) {
                try {
                    System.out.println("t2 sleep 2s");
                    Thread.sleep(2000);
                    System.out.println("t2 sleep end");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();


        synchronized (lock) {
            System.out.println("main get lock");
        }

    }

    private static void print(Object i) {
    }
}